<template>
  <div class="PopulationStatistics card-bg">
    <div class="card-title">人口统计</div>
    <div class="content">
      <div class="item">
        <img src="../../../assets/img/group.png" alt="" />
        <div v-if="data?.length >= 1" class="count">{{ data[0].Value }}</div>
        <div class="type">常驻人口</div>
      </div>
      <div class="item">
        <img src="../../../assets/img/group.png" alt="" />
        <div v-if="data?.length >= 2" class="count">{{ data[1].Value }}</div>
        <div class="type">住户</div>
      </div>
      <div class="item">
        <img src="../../../assets/img/group.png" alt="" />
        <div v-if="data?.length >= 3" class="count">{{ data[2].Value }}</div>
        <div class="type">重点人员</div>
      </div>
      <div class="item">
        <img src="../../../assets/img/group.png" alt="" />
        <div v-if="data?.length >= 4" class="count">{{ data[3].Value }}</div>
        <div class="type">关爱人员</div>
      </div>
      <div class="item">
        <img src="../../../assets/img/group.png" alt="" />
        <div v-if="data?.length >= 5" class="count">{{ data[4].Value }}</div>
        <div class="type">疑似入住</div>
      </div>
      <div class="item">
        <img src="../../../assets/img/group.png" alt="" />
        <div v-if="data?.length >= 6" class="count">{{ data[5].Value }}</div>
        <div class="type">疑似搬离</div>
      </div>
    </div>
  </div>
</template>
<script>
import { peopleGroup } from "@/api/panoramicData";
export default {
  mounted() {
    this.runPeopleGroup();
  },
  data() {
    return {
      data: "",
    };
  },
  methods: {
    async runPeopleGroup() {
      const res = await peopleGroup();
      this.data = res.data;
    },
  },
};
</script>
<style lang="scss" scoped>
.PopulationStatistics {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 10px;

  img {
    width: 50px;
  }

  .count {
    color: #ffcf37;
    font-size: 24px;
  }

  .type {
    color: #a8d6ff;
    font-size: 14px;
  }
  .content {
    display: flex;
    text-align: center;
    width: 100%;
    height: calc(100% - 50px);
    flex-wrap: wrap;
  }
  .item {
    width: 33.33%;
    height: 50%;
    margin-top: 8px;
  }
}
</style>
